// user.js
import { defineStore } from 'pinia'
import { GetCategory,GetProductData } from '../api/product.js'
import {ShowCountList} from '../api/order.js'
import {GetUserList} from '../api/user.js'

export const useUserStore = defineStore({
  id: 'user',
  state: () => ({
    categoryNum: 0,
    productNum: 0,
    orderNum: 0,
    userNum: 0
  }),
  actions: {
    async GetCategory() {
      const result = await GetCategory()
      this.categoryNum = result.data.length
    },
    async GetproductList() {
      const result = await GetProductData()
      this.productNum = result.data.length
    },
    async GetShowCountList() {
      const result = await ShowCountList()
      this.orderNum = result.data.length
    },
    async GetUserData() {
      const result = await GetUserList()
      this.userNum = result.data.length
    },

  }
})